<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      //Symbol唯一
    //   let key1 = Symbol('lipan');
    //   let key2 = Symbol('lipan');
    //   //   console.log(key1 === key2);
    //   //Symbol.for 有赋值返回之前的
    //   let total = Symbol.for('haha');
    //   let total1 = Symbol.for('haha');
    //   //   console.log(total === total1);

    //   //symbol的充当对象的key
    //   const obj = {
    //     [key1]: 5,
    //     [key2]: 6,
    //   };
    //   obj['key1'] = { age: 15 };
    //   console.log(obj);
    //   console.log(obj[key2])
      
      //Symbol 的访问
      let obj = {
        a:1,
        b:2,
        [Symbol('c')]:3,
        [Symbol('d')] :5,
      }
      console.log(Object.keys(obj))
      console.log(Object.values(obj))
      //Symbol只能通过getOwnPropertySymbols枚举,不能进行运算
      console.log(Object.getOwnPropertySymbols(obj))
      //数组的key 与Symbol合并
      let arr =[...Object.keys(obj),...Object.getOwnPropertySymbols(obj)]
      console.log(arr)
    </script>
  </body>
</html>
